<template>
  <div class="mine">
      <div class="com-top-nav">
        <van-nav-bar
        title="我的"
      />
      </div>
      <div>
          <div top-person-module>
            <div left>
                <h3>{{company.name?company.name:'暂无名称'}}</h3>
                <span>这个人超级酷，一点签名都不写~</span>
            </div>
            <div right><img :src="company.avatar" alt=""></div>
          </div>
      </div>
      <div com-list-cell>
          <ul>
            <router-link class="item" :to="{name:'enterpriseInfo'}" tag="li" >
              <img src="/static/img/my.svg" alt="">
              <p>
                <span>企业信息</span>
                <span></span>
              </p>
            </router-link>
            <router-link :to="{name:'enterpriseCert'}" class="item" tag="li" >
              <img src="/static/img/certification.svg" alt="">
              <p>
                <span>企业认证</span>
                <span></span>
              </p>
            </router-link>
             <router-link :to="{name:'myWallet'}" class="item" tag="li" >
              <img class="img" src="/static/img/wallet.svg" alt="">
              <p>
                <span>我的钱包</span>
                <span>
                  <!-- <img src="/static/img/right.svg" alt=""> -->
                </span>
              </p>
            </router-link>
             <router-link :to="{name:'feedback'}" class="item" tag="li" >
              <img src="/static/img/help.svg" alt="">
              <p>
                <span>帮助与反馈</span>
                <span></span>
              </p>
            </router-link>
             <router-link :to="{name:'myBill'}" class="item" tag="li" >
              <img src="/static/img/bill.svg" alt="">
              <p>
                <span>我的账单</span>
                <span></span>
              </p>
            </router-link>
            <li class="item" @click="changeId">
               <img src="/static/img/change.svg" alt="">
              <p>
                <span>身份切换</span>
                <span></span>
              </p>
            </li>
            <li class="item" @click="cleanHandle">
              <img src="/static/img/clean2.svg" alt="">

              <p>
                <span>清理缓存</span>
              </p>
            </li>
          <!--    <router-link class="item" tag="li" :to="{name:'mine'}">
              <img src="static/img/clean2.svg" alt="">
              <p>
                <span>身份切换</span>
                <span></span>
              </p>
            </router-link> -->
              <router-link :to="{name:'historyRelease'}" class="item" tag="li" >
              <img src="/static/img/history.svg" alt="">
              <p>
                <span>历史发布</span>
                <span></span>
              </p>
            </router-link>
          </ul>
      </div>
      <bottom-person-nav/>
  </div>
</template>
<script>
import bottomNav from '../components/person-nav.vue'
import Vue from 'vue'
import { NavBar } from 'vant';

Vue.use(NavBar);
export default {
  data(){
    return {
      company:{}
    }
  },
    methods:{
    changeId(){
      this.axios.get('/api/switch',{params:{uid:JSON.parse(sessionStorage.getItem('user')).uid}}).then(r=>{
        sessionStorage.setItem("identity",r.data.data.identity)
        this.$router.push({name:'mine'})
      })
    },
      cleanHandle(){
        sessionStorage.clear();
        sessionStorage.clear();
        this.$router.push({path:'/'})
      }
  },
    mounted(){
        this.axios.get('/api/company',{params:{
          uid:JSON.parse(sessionStorage.getItem("user")).uid
        }}).then(result=>{
          this.company= result.data.data
        })
    },
    components:{
        'bottom-person-nav':bottomNav
    }
}
</script>

<style lang="less" scope>
@import url('../../static/style/bottom-person-nav.less');
@import url('../../static/style/mine.less');
.demo-color-btn {
  margin: 8px;
}
</style>
